<div id="app" v-cloak>
    <div class="flex-column">
        <div class="bottom20">
            <el-button type="primary" size="small" @click="common.add()">添加</el-button>
<!--            <el-button type="danger" size="small" :disabled="delList.length>0?false:true" @click="delAll">删除</el-button>-->
            <el-button type="primary" size="small" @click="common.refresh()"><el-icon :size="15"><Refresh /></el-icon>
            </el-button>
        </div>
        <el-table :data="adminList.rows" border style="width: 100%">
            <el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
            <el-table-column prop="username" label="用户名" align="center"></el-table-column>
            <el-table-column prop="nickname" label="昵称" align="center"></el-table-column>
            <el-table-column prop="avatar" label="头像" align="center">
                <template #default="scope" >
                    <img :src="scope.row.avatar" alt="" style="width: 50px;height: 50px;border-radius: 25px">
                </template>
            </el-table-column>
            <el-table-column prop="email" label="电子邮箱" align="center"></el-table-column>
            <el-table-column prop="group" label="分组" align="center"></el-table-column>
            <el-table-column prop="logintime" label="登录时间" align="center">
                <template #default="scope">
                    {{getTime(scope.row.logintime)}}
                </template>
            </el-table-column>
            <el-table-column prop="loginip" label="登录IP" align="center"></el-table-column>
            <el-table-column prop="status" label="状态" align="center">
                <template #default="scope">
                    <el-switch v-model="scope.row.status" :disabled="scope.row.id==1?true:false" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="common.changeSwitch(scope.row,`id`,`status`)"></el-switch>
                </template>
            </el-table-column>
            <el-table-column prop="status" label="操作" align="center">
                <template #default="scope">
                    <el-button type="primary" size="small" @click="common.edit(scope.row,`id`)">编辑</el-button>
                    <el-button type="danger" :disabled="scope.row.id==1?true:false" size="small" @click="common.del(scope.row,`id`)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

    </div>
</div>